﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using DomusDotNet.Sbm.Client.SL4noCM.Infrastructure;

namespace DomusDotNet.Sbm.Client.SL4noCM.Views
{
    public partial class ShellView : UserControl
    {

        public ShellView()
        {
            InitializeComponent();

            App.Messenger.Register<string>(Messages.Login, new Action<string>(MessageHandler));
            App.Messenger.Register<string>(Messages.Logout, new Action<string>(MessageHandler));
            this.ActiveItem.Content = new LoginView() ;
        }

        private  void MessageHandler(string arg)
        {
            if (arg == Messages.Login) this.ActiveItem.Content = new SearchView();
            if (arg == Messages.Logout) this.ActiveItem.Content = new LoginView();
        }
    }
}
